<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>RunJS</title>
        <script src="//lib.baomitu.com/jquery/1.8.3/jquery.min.js"></script>
    </head>
    <body>
        <h1 >
            实时监测input中值的变化
        </h1>
        <input type="text" id="username" autoComplete='off'>
        <div id="result"></div>
    </body>
</html>
<script>
    $(function(){
        $('#username').bind('input propertychange', function() {
            $('#result').html($(this).val().length + ' characters');
        });
    })
</script>